{include file="header.html"}
<div id="rightTop">
    <p><b>{$lang.order_detail}</b></p>
</div>
<div class="info">
    <div class="demand">
    </div>
    <div class="order_form">
        <h1>{$lang.order_status}</h1>
        <ul>
            <li>
                <b>{$lang.order_sn}:</b>{$order.order_sn}
                {if $order.extension eq 'groupbuy'}[{$lang.groupbuy}]{/if}&nbsp;&nbsp;&nbsp;
                <!--{if $order.group_id}-->
                    [<a href="{$site_url}/index.php?app=groupbuy&id={$order.group_id}" target="_blank">{$lang.groupbuy_detail}</a>]
                <!--{/if}-->
            </li>
            <li>
                <b>{$lang.order_status}:</b> {$order.status|modifier:order_status}
                <!--{if $order.status neq 0 && $order.status neq 11 && $order.status neq 50}-->
                    <a href="javascript:;" class="btn1" id="refund_order">客服介入</a>
                <!--{/if}-->
            </li>
            <li>
                <b>订单来源:</b> {$order.device|default:无}
            </li>

            <!--{if $order.abnormal_reason}-->
                <li>
                    <b>异常原因:</b> {$order.abnormal_reason	}
                </li>
            <!--{/if}-->
            <li>
                <b>{$lang.order_amount}:</b> <span class="red_common">{$order.goods_amount|price}</span>
                ({$lang.preference}:{$order.discount|price})
            </li>
            <li>
                <b>{$lang.pay_amount}:</b> <span class="red_common">{$order.order_amount|price}</span>
                <!--{if $order.type eq 'wishOrder'}-->
                    <b>帮砍人数：</b> <span class="red_common">{$order.wishInfo.count}</span>
                    <b>帮砍金额：</b> <span class="red_common">{$order.wishInfo.helpPrice|price}</span>
                    <b>首款：</b> <span class="red_common">{$order.wishInfo.firstPrice|price}</span>
                    <!--<b>尾款：</b> <span class="red_common">{$order.wishInfo.endPrice|price}</span>-->
                <!--{/if}-->
            </li>
        </ul>
        <div class="clear"></div>
    </div>
    <div class="order_form">
        <h1>{$lang.order_detail}</h1>
        <h2>{$lang.order_info}</h2>
        <ul>
            <li><b>{$lang.buyer_name} :</b> <!--{if $order.buyer_name neq ''}-->{$order.buyer_name}<!--{else}-->{$order.phone_mob}<!--{/if}--></li>
            <li><b>{$lang.seller_name} :</b> {$order.seller_name|escape}</li>
            <!--{if $order.payment_code}-->
            <li><b>{$lang.payment_name}:</b>{$order.payment_name|escape}</li>
            <!--{/if}-->
            <!--{if $order.pay_message}-->
            <li><b>{$lang.pay_message}:</b>{$order.pay_message|escape}</li>
            <!--{/if}-->
            <li><b>{$lang.add_time}:</b>{$order.add_time|date:complete}</li>
            <!--{if $order.pay_time}-->
            <li><b>{$lang.pay_time}:</b>{$order.pay_time|date:complete}</li>
            <!--{/if}-->
            <!--{if $order.ship_time}-->
            <li><b>{$lang.ship_time}:</b>{$order.ship_time|date:complete}</li>
            <!--{/if}-->
            <!--{if $order.finished_time}-->
            <li><b>{$lang.finished_time}:</b>{$order.finished_time|date:complete}</li>
            <!--{/if}-->
            <!--{if $order.postscript}-->
            <li><b>{$lang.postscript}:</b>{$order.postscript|escape}</li>
            <!--{/if}-->
        </ul>
        <div class="clear"></div>
    </div>

    <div class="order_form">
        <h2>{$lang.consignee_info}</h2>
        <ul>
            <li><b>{$lang.consignee}:</b> {$order_extm.consignee|escape}</li>
            <li><b>{$lang.region}:</b> {$order_extm.region_name|escape}</li>
            <li><b>{$lang.zipcode}:</b> {$order_extm.zipcode|escape}</li>
            <li><b>{$lang.phone_mob}:</b> {$order_extm.phone_mob|escape}</li>
            <li><b>{$lang.address}:</b> {$order_extm.address|escape}</li>
            <li><b>{$lang.shipping_name}:</b> {$order_extm.shipping_name|escape}</li>
            <!--{if $order.invoice_no}-->
            <li><b>{$lang.invoice_no}:</b> {$order.invoice_no|escape}</li>
            <!--{/if}-->
        </ul>
        <div class="clear"></div>
    </div>
    <div class="order_form">
        <h2>{$lang.goods_info}</h2>
        <!--{foreach from=$goods_list item=goods}-->
        <div class="order_info">
            <a href="{$site_url}/index.php?app=goods&amp;id={$goods.goods_id}" target="_blank" class="order_info_pic">
                <img width="50" height="50" alt="{$lang.goods_pic}" src="{$goods.goods_image}" />
            </a>
            <div class="order_info_text">
                <a href="{$site_url}/index.php?app=goods&amp;id={$goods.goods_id}" target="_blank">{$goods.goods_name|escape}</a>
                <br />{$goods.specification}
            </div>
            <p><b>{$lang.price} :</b> <span class="red_common">{$goods.price|price}</span></p>
            <p><b>是否为特卖商品 :</b> <span class="red_common">
                <!--{if $goods.sales eq 1}-->
                是
                <!--{else}-->
                否
                <!--{/if}-->
             </span></p>
            <p><b>{$lang.quantity} :</b> {$goods.quantity}</p>
        </div>
        <!--{/foreach}-->
        <div class="clear"></div>
    </div>
    <form method="post" enctype="multipart/form-data" id="user_form" style="display: none">
        <table class="infoTable">

            <tr>
                <th class="paddingT15"> 操作:</th>
                <td class="paddingT15 wordSpacing5">
                    <p>
                        <!--<label>-->
                        <!--<input name="type" type="radio" value="2" checked="checked"/>-->
                        <!--</label>-->
                        <label>
                            <input type="radio" name="type" value="1" checked/>取消订单并申请退款
                        </label>
                    </p>
                </td>
            </tr>


            <tr>
                <th class="paddingT15"> 退款原因:</th>
                <td class="paddingT15 wordSpacing5">
                    <input class="infoTableInput2" id="refund_reason" type="text" name="refund_reason" style="width:300px" />
                    <label class="field_notice">请填写退款原因</label>
                </td>
            </tr>


            <tr>
                <th class="paddingT15"> 退款描述:</th>
                <td class="paddingT15 wordSpacing5">
                    <input class="infoTableInput2" name="refund_desc" type="text" id="refund_desc" style="width:300px" />
                    <span class="field_notice">请填写退款描述</span>
                </td>
            </tr>
            <tr>
                <th class="paddingT15"> 收货情况:</th>
                <td class="paddingT15 wordSpacing5">
                    <input class="infoTableInput2" name="refund_shipped" type="text" id="refund_shipped" style="width:300px" />
                    <span class="field_notice">请填写收货情况</span>
                </td>
            </tr>
             <tr>
                <th class="paddingT15"> 超卖情况:</th>
                <td class="paddingT15 wordSpacing5">
                    <input class="infoTableInput2" value="0" name="OverSellNum" type="number" id="OverSellNum" style="width:300px" />
                    <span class="field_notice">请填写超卖情况</span>
                </td>
            </tr>
            <tr>
                <th></th>
                <td class="ptb20">
                    <a href="javascript:;" class="btn1" id="refund_submit">提交</a>
                </td>
            </tr>
        </table>
    </form>
</div>
<script>
    $("#refund_order").click(function(){
        $("#user_form").toggle();
    })
    $("#refund_submit").click(function(){
        var refund_reason = $("#refund_reason").val();
        var refund_desc = $("#refund_desc").val();
        var refund_shipped = $("#refund_shipped").val();
        var OverSellNum = $("#OverSellNum").val();
        var order_ids = {$order.order_id};
        if(refund_reason == ''){
            alert('请填写退款原因');
            return false;
        }
        if(refund_desc == ''){
            alert('请填写退款描述');
            return false;
        }
        if(refund_shipped == ''){
            alert('请填写收货情况');
            return false;
        }
        if(OverSellNum < 0){
            alert('请填写正确的超卖数量！');
            return false;
        }
        var url = "index.php?app=order&act=customer";
        $.post(url,{
            order_id:order_ids,
            refund_reason:refund_reason,
            refund_desc:refund_desc,
            refund_shipped:refund_shipped,
            OverSellNum:OverSellNum
        },function(data){
            var res = JSON.parse(data);
            if(res.code == 1){
                alert(res.msg);
                window.location.reload();
            }else{
                alert(res.msg);
                return false;
            }
        })

    })
</script>
{include file="footer.html"}
